<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="common/common_head :: commonHeader('配额历史记录')"/>
    <link rel="stylesheet" th:href="@{/static/js/plugins/jquery-layout/jquery.layout-latest.css}">
</head>
<body class="gray-bg">
<div class="container-div ui-layout-center">
    <div class="row">
        <div class="col-sm-12 search-condition">
            <form id="quotaForm" th:action="@{/quota/historyList}" class="form-inline">
                <div class="select-list">
                    <ul>
                        <li class="col-sm-3">
                            <label>供应商编码：</label>
                            <input type="text" name="vendorCode"/>
                        </li>
                        <li class="col-sm-3">
                            <label>物料编码：</label>
                            <input type="text" name="materialCode"/>
                        </li>
                        <li class="col-sm-3">
                            <label>工厂 ：</label>
                            <select name="werks" sysDict="GC" emptyFirst="true"></select>
                        </li>
                        <li class="col-sm-3">
                            <button id="quotaSearchBtn" type="button" class="btn btn-primary btn-rounded btn-sm"><i
                                    class="fa fa-search"></i>&nbsp;搜索
                            </button>
                            <button class="btn btn-warning btn-rounded btn-sm" type="reset"><i class="fa fa-eraser"></i>&nbsp;重置
                            </button>
                            <button id="quotaAdvancedSearch" type="button" class="btn btn-primary btn-rounded btn-sm"
                                    style="display: none"><i class="fa fa-caret-down"></i>&nbsp;高级搜索
                            </button>
                        </li>
                    </ul>

                </div>
            </form>
        </div>
        <div class="col-sm-12 select-info">
            <div class="col-sm-12 select-info">
                <table id="quota"></table>
            </div>
        </div>
    </div>
</div>
<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<script type="text/javascript" th:src="@{/static/js/plugins/jquery-layout/jquery.layout-latest.js}"></script>

<script type="text/javascript">
    //面向对象
    var searcherBS = Searcher.createBS('#quota',
        [
            {checkbox: true},
            {title: "物料号", field: "materialCode"},
            {title: "物料描述", field: "materialDesc"},
            {title: "供应商编码", field: "vendorCode"},
            {title: "工厂", field: "werks"},
            {title: "供应商名称", field: "vendorName"},
            {title: "配额比", field: "percentile"},
            {title: "配额数", field: "quotaNum"},
            {
                title: "剩余配额数", field: "usedQuotaNum",
                formatter: function (value, row, index) {
                    if (row.quotaNum) {
                        return row.quotaNum - value;
                    }
                }
            },
            {title: "创建者", field: "createdBy"},
            {title: "开始时间", field: "startDate"},
            {title: "结束时间", field: "endDate"},
            {title: "创建日期", field: "creationDate"}
        ]
    );
    $(function () {
        //初始化所有字典数据
        initDictDataSel();
    });

    /**
     * 查询数据
     */
    function refresh() {
        searcherBS.refresh();
    }
</script>
</body>